package com.study.feignClient;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study.config.FeignConfig;
import com.study.constant.ApiRouterConstant;
import com.study.convention.result.Result;
import com.study.dto.req.ShortLinkPageReqDTO;
import com.study.dto.resp.ShortLinkGroupCountQueryRespDTO;
import com.study.dto.resp.ShortLinkPageRespDTO;
import com.study.feignClient.feignFallback.GroupShortLinkFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author canace
 * @version 1.0
 * @description 使用Feign获取短链接分组中短链接的数量
 * @date 2024/1/31 19:32
 */
@Primary
@FeignClient(value = "shortlink-gateway", configuration = FeignConfig.class, fallback = GroupShortLinkFeignFallback.class)
public interface GroupShortLinkClient {

    /**
     * 获取分组中短链接的数量
     *
     * @param requestParam 分组id（集合）
     * @return 分组中短链接的数量
     */
    @GetMapping(ApiRouterConstant.BASE_API_V1 + "/count")
    Result<List<ShortLinkGroupCountQueryRespDTO>> listGroupShortLinkCount(@RequestParam("requestParam") List<String> requestParam);


    /**
     * 根据gid分页获取分组短链接信息
     *
     * @param requestParam 分组Gid和排序信息
     * @return 分页信息
     */
    @GetMapping(ApiRouterConstant.BASE_API_V1 + "/page")
    Result<Page<ShortLinkPageRespDTO>> getPageShortLink(@SpringQueryMap ShortLinkPageReqDTO requestParam);


}
